//
//  HNSH_WithdrawalCellView.m
//  HNSH_SingleProject
//
//  Created by 李宇廷 on 2023/6/14.
//

#import "HNSH_WithdrawalCellView.h"

@implementation HNSH_WithdrawalCellView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        [self configUI];
    }
    return self;
}

- (void)configUI {
    [self addAllViews];
    [self addAllLayout];
}

- (void)addAllViews {
    [self addSubview:self.icon];
    [self addSubview:self.titleLabel];
    [self addSubview:self.selectButton];
    [self addSubview:self.showIcon];
    [self addSubview:self.desLabel];
}

- (void)addAllLayout {
    [self.icon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(24);
        make.centerY.mas_equalTo(self.mas_centerY);
        make.width.height.mas_equalTo(36);
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.icon.mas_right).offset(12);
        make.centerY.mas_equalTo(self.mas_centerY);
        make.height.mas_equalTo(40);
    }];
    
    [self.selectButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-24);
        make.centerY.mas_equalTo(self.mas_centerY);
        make.width.height.mas_equalTo(20);
    }];
    
    [self.showIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-24);
        make.centerY.mas_equalTo(self.mas_centerY);
        make.width.height.mas_equalTo(20);
    }];
    
    [self.desLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-44);
        make.centerY.mas_equalTo(self.mas_centerY);
        make.height.mas_equalTo(22);
    }];
}

#pragma mark lazy
- (UIImageView *)icon {
    if (!_icon) {
        _icon = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"icon_alipay"]];
        _icon.contentMode = UIViewContentModeScaleAspectFill;
    }
    return _icon;
}


- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc]init];
        _titleLabel.text = @"支付宝";
        _titleLabel.textColor = [UIColor colorWithHexString:@"#333333"];
        _titleLabel.font = [UIFont boldSystemFontOfSize:16];
    }
    return _titleLabel;
}

- (UIButton *)selectButton {
    if (!_selectButton) {
        _selectButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [_selectButton setImage:[UIImage imageNamed:@"base_select_off"] forState:UIControlStateNormal];
        [_selectButton setImage:[UIImage imageNamed:@"base_select_on"] forState:UIControlStateSelected];
    }
    return _selectButton;
}

- (UIImageView *)showIcon {
    if (!_showIcon) {
        _showIcon = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"base_nav_show_right"]];
        _showIcon.contentMode = UIViewContentModeScaleAspectFill;
    }
    return _showIcon;
}

- (UILabel *)desLabel {
    if (!_desLabel) {
        _desLabel = [[UILabel alloc]init];
        _desLabel.text = @"452874130303055";
        _desLabel.textColor = [UIColor colorWithHexString:@"#999999"];
        _desLabel.font = [UIFont systemFontOfSize:16];
    }
    return _desLabel;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
